package p.ithorns.sample.websocket.debugger;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import p.ithorns.sample.websocket.model.WsUpMsg;

import javax.validation.constraints.NotNull;

/**
 * LocateWebSocketMsgHandler
 *
 * @author Ht.L
 * @date 2023-06-19 10:23
 * @since 1.0.0
 */
@Slf4j
@Component
public class DebugWsMsgHandler {

//    @Resource
//    private WsCacheService wsCache;

    public void handle(@NotNull WsUpMsg<String> msg) {
        if (null != msg) {
            // TODO 消息处理
            String clientId = msg.getClientId();
            // WsParam<?> clientParam = wsCache.getClientParam(clientId);
            DebugWsTcpSupervise.sendToWs(clientId, "SVC: " + msg.getData());
        }
    }

}